package de.graph.common.impl;

import java.util.Collection;

import de.graph.common.Edge;
import de.graph.common.Vertex;
import de.graph.document.Document;


final class VertexImpl extends ElementImpl implements Vertex {

    protected static final String IN_EDGES = "inEdges";
    protected static final String OUT_EDGES = "outEdges";

	protected VertexImpl(final Document document) {
        super(document);
    }

    public Collection<Edge> getOutEdges() {
        return getDocument().getProperty(OUT_EDGES);
    }

    public Collection<Edge> getInEdges() {
        return getDocument().getProperty(IN_EDGES);
    }

    @Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		
		builder.append("vertex(");
		builder.append((getLabel().length() > 0) ? getLabel() : getDocument().getId());
        builder.append(")");
		
		return builder.toString();
	}
}
